<template>
  <div>
    <!-- 轮播图 子组件-->
    <swiper :imgList="imgList"></swiper>
    <!-- 九宫格图标 -->
     <ul class="mui-table-view mui-grid-view mui-grid-9">
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
          <router-link to="/news/list">
            <img src="../../imgs/menu1.png" alt="">
            <div class="mui-media-body">新闻资讯</div>
          </router-link>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
          <router-link to="/photo/list">
            <img src="../../imgs/menu2.png" alt="">
            <div class="mui-media-body">图片分享</div>
          </router-link>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
          <router-link to="/goods/list">
            <img src="../../imgs/menu3.png" alt="">          
            <div class="mui-media-body">商品购买</div>
          </router-link>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
          <router-link to="#">
            <img src="../../imgs/menu4.png" alt="">          
            <div class="mui-media-body">留言反馈</div>
          </router-link>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
          <router-link to="#">
            <img src="../../imgs/menu5.png" alt="">         
            <div class="mui-media-body">视频专区</div>
          </router-link>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
          <router-link to="#">
            <img src="../../imgs/menu6.png" alt="">
            <div class="mui-media-body">联系我们</div>
          </router-link>
        </li>
      </ul> 
  </div>
</template>
<script>
// 图片加载失败提示窗口
import { Toast } from "mint-ui";
// 轮播图子组件
import swiper from "../myModules/swiper.vue";

export default {
  data() {
    return {
      imgList: []
    };
  },
  // 在数据创建完成后调用获取轮播图图片的函数
  created() {
    this.getImgList();
  },
  components: {
    swiper
  },
  methods: {
    getImgList() {
      this.$http.get("api/getlunbo").then(res => {
        console.log(res.body);
        if (res.body.status == 0) {
          this.imgList = res.body.message;
        } else {
          Toast("图片加载失败");
        }
      });
    }
  }
};
</script>
<style lang="scss" scoped>
.mint-swipe {
  height: 200px;
  img {
    width: 100%;
    height: 100%;
  }
}
.mui-grid-view.mui-grid-9 {
  border: 0;
  background-color: #fff;
  .mui-table-view-cell {
    border: 0;
    img {
      width: 60px;
    }
    .mui-media-body {
      font-size: 14px;
    }
  }
}
</style>